package Spil;

import desktop_resources.GUI;

public class FieldTax extends GameFields {

	private int taxAmount;
	private double taxRate;
	private int taxRatePro;
	private String Answer;

	public FieldTax (int taxAmount, int taxRate, String Name, int id) {
		super.setName(Name);
		super.setId(id);
		super.setType("Tax");
		this.taxAmount = taxAmount;
		this.taxRate = (double) taxRate/100;
		this.taxRatePro = taxRate;
	}

	@Override
	public void landOnField(Player player) {
     if(super.getName() == "Goldmine") 
       {
			GUI.displayChanceCard(Txt.Tax2);
			player.addBalance(-2000);
       }
     
		if (super.getName() == "Caravan")
		{
			Answer = GUI.getUserButtonPressed(Txt.Tax, Txt.FieldTax, Txt.FieldTax2);
			if(Answer == Txt.FieldTax) {
				player.addBalance(-4000);
			}
			else if(Answer == Txt.FieldTax2) {
				double pay = player.bank.getBalance();
				pay = pay * this.taxRate;
				player.addBalance((int) -pay);
			}
		}
	}
 
	public int getTaxAmount(){
		return this.taxAmount;
	}

	public double getTaxRate(){
		return this.taxRate;
	}

	public double getTaxRatePro(){
		return this.taxRatePro;
	}

	@Override
	public void removeOwner(Player player, int fieldNumber) {
		//Der sker intet
	}

	
}
